// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Wheel Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 55 : TYPE_WHEEL

// Function declarations
reserve function Wheel_DebugDraw
reserve function Wheel_DebugSpawn

// Static Values

// Tables

function Wheel_DebugDraw
	DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
end function


function Wheel_DebugSpawn
	CreateTempObject(TypeName[Wheel], 0, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 4
end function


event ObjectMain
	if object.value0 != LZSetup_value30
		object.direction ^= FLIP_X
		object.value0 = LZSetup_value30
		temp2 = 1
	else
		object.frame = oscillation
		object.frame >>= 2
		object.frame &= 3
		if object.direction == FLIP_X
			object.frame ^= 3
		end if
	end if
end event


event ObjectDraw
	DrawSprite(object.frame)
end event


event ObjectStartup
	LoadSpriteSheet("LZ/Objects.gif")
	SpriteFrame(-16, -16, 32, 32, 223, 22)
	SpriteFrame(-16, -16, 32, 32, 223, 55)
	SpriteFrame(-16, -16, 32, 32, 223, 88)
	SpriteFrame(-16, -16, 32, 32, 223, 121)
	foreach (TypeName[Wheel], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].drawOrder = 5
	next
	SetTableValue(TypeName[Wheel], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(Wheel_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(Wheel_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
